//
//  ViewController.m
//  CYPopSelectView
//
//  Created by 楼楚 on 16/6/2.
//  Copyright © 2016年 Chu Lou. All rights reserved.
//

#import "ViewController.h"
#import "CYPopSelectView.h"

@interface ViewController ()<selectIndexPathDelegate>
@property(nonatomic, readwrite, strong)UIButton *addButton;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.addButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.addButton setTitle:@"+" forState:(UIControlStateNormal)];
    [self.addButton setFrame:CGRectMake(100, 100, 30, 30)];
    [self.addButton setBackgroundColor:[UIColor grayColor]];
    [self.addButton setTintColor:[UIColor blackColor]];
    
    [self.addButton addTarget:self action:@selector(buildPopView) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:self.addButton];
    
}
- (void)buildPopView{
    CGPoint demoPoint = CGPointMake(200, 200);
    CYPopSelectView *popSView = [[CYPopSelectView alloc]initWithOrigin:demoPoint Width:200 Height:40*3 Type:CYTypeOfDownCenter Color:[UIColor colorWithRed:0.3 green:0.3 blue:0.3 alpha:1.0]];
    popSView.titleArray = @[@"订阅微博",@"订阅博客",@"订阅其他"];
    popSView.imageArray = @[@"me",@"you",@"hey"];
    popSView.row_height = 40;
    popSView.fontSize = 13;
    popSView.titleColor = [UIColor whiteColor];
    popSView.delegate = self;
    [popSView popView];
    
}
- (void)selectIndexPathRow:(NSInteger )index{
    switch (index) {
        case 0:
            NSLog(@"choose微博");
            break;
        case 1:
            NSLog(@"choose博客");
            break;
        case 2:
            NSLog(@"choose其他");
            break;
            
        default:
            break;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
